/**
 * 
 */
package neptune.manager.validator.rules.node;

import neptune.manager.model.topology.Node;
import neptune.manager.utils.Logger.MessageType;
import neptune.manager.validator.ValidatorResult;
import neptune.manager.validator.ValidatorRule;
import neptune.manager.validator.Validator.Status;

/**
 * @author Roberto Bifulco [RobertoBifulco.it] [info@robertoBifulco.it]
 * 
 */
public class ControlPortRule extends ValidatorRule<Node> {

	@Override
	public String getName() {
		return "ControlPortRule";
	}

	@Override
	protected ValidatorResult validationAlgorithm(Node toValidate,
			ValidatorResult result) {

		if (toValidate.getControlPort() == 0) {
			result.setStatus(Status.ERROR);
			result.getLog().addMessage("Control port is not set.",
					MessageType.ERROR);
		}

		return result;
	}

}
